const fs = require('fs')
const browserify = require('browserify')

// npm run build  报错 Uncaught ReferenceError: regeneratorRuntime is not defined
browserify('./src/main.js')
  .transform("babelify", {
    presets: [
      ["@babel/preset-env", {
        "useBuiltIns": false,
      }], 
      "@babel/preset-react"
    ],
    plugins: [
      // ["transform-runtime", {
      //   "polyfill": true,
      //   "regenerator": true
      // }]
      "@babel/plugin-transform-runtime"
    ]
  })
  .bundle()
  .pipe(fs.createWriteStream('./bundle.js'))